'use strict';
const db = uniCloud.database();
exports.main = async (event, context) => {
  const collection = db.collection('users');

  const res = await collection.get();
  let user=event;
  let list=res.data;
  let status=0;
  let body='';
  for (var i = 0; i < list.length; i++) {
  	if(list[i].username==user.user_name){
		if(list[i].password==user.password){
			status=2;
			body=list[i];
			break;
		}else{
			status=1;
			break;
		}
	}
  }
  return {"status":status, "body":body}
};
